package com.weigee.ktv.v.activity;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;

import com.amap.api.maps.model.RuntimeRemoteException;
import com.weigee.ktv.v.fragment.AboutUsFragment;
import com.weigee.ktv.v.fragment.CheckSingingTimeFragment;
import com.weigee.ktv.v.fragment.CommonProblemsFragment;
import com.weigee.ktv.v.fragment.FeedbackFragment;
import com.weigee.ktv.v.fragment.MainFragment;
import com.weigee.ktv.v.fragment.MyWalletDataFragment;
import com.weigee.ktv.v.fragment.RechargeReturnFragment;
import com.weigee.ktv.v.fragment.RoomReservationListFragment;
import com.weigee.ktv.v.fragment.SafetySettingsFragment;
import com.weigee.ktv.v.fragment.SupermarketChooseGoodsFragment;
import com.weigee.ktv.v.fragment.SupermarketStoreFragment;
import com.weigee.ktv.v.fragment.SystemInformsFragment;
import com.weigee.ktv.v.fragment.TermsUseFragment;
import com.weigee.ktv.v.fragment.TransactionHistoryFragment;
import com.weigee.ktv.v.fragment.WeigeeOthersMsgFragment;
import com.weigee.ktv.v.fragment.WelcomeFragment;
import com.weigee.ktv.v.fragment.WriteReserveMessageFragment;

/**
 * Created by 林德 on 2017/4/12 15:57.
 * <p/>
 */
public final class ActivityUtil {
    // 主界面
    public static final String MAIN = "Main";

    // 个人中心 -> 消息
    public static final String SYSTEM_INFORMS = "SYSTEM_INFORMS";
    // 个人中心 -> 客服/反馈
    public static final String USER_PROFILE_FEEDBACK = "Feedback";
    // 个人中心 -> 其他
    public static final String USER_PROFILE_OTHERS_MSG = "USER_PROFILE_OTHERS_MSG";
    // 个人中心 -> 其他 -> 使用条款
    public static final String TERMS_USE = "TERMS_USE";
    // 个人中心 -> 其他 -> 常见问题
    public static final String COMMON_PROBLEMS = "COMMON_PROBLEMS";
    // 个人中心 -> 其他 -> 关于我们
    public static final String ABOUT_US = "ABOUT_US";

    // 包房预定
    public static final String ROOM_RESERVATION = "ROOM_RESERVATION";
    // 包房预定 -> 填写预定信息
    public static final String WRITE_RESERVE_MSG = "WRITE_RESERVE_MSG";
    // 包房预定 -> 选择欢唱时间
    public static final String CHECK_SINGING_TIME = "CHECK_SINGING_TIME";

    // 超市店铺
    public static final String SUPERMARKET_STORE = "SUPERMARKET_STORE";
    // 超市商品列表
    public static final String SUPERMARKET_SHOPPING_LIST = "SUPERMARKET_SHOPPING_LIST";

    // 钱包
    public static final String WALLET_DATA = "WALLET_DATA";
    // 钱包 -> 充值返利
    public static final String RECHARGE_RETURN = "RECHARGE_RETURN";
    // 钱包 -> 交易记录
    public static final String TRANSACTION_HISTORY = "TRANSACTION_HISTORY";
    // 钱包 -> 安全设置
    public static final String SAFETY_SETTINGS = "SAFETY_SETTINGS";

    private ActivityUtil() {
    }

    @NonNull
    static Fragment fragment(@Nullable final String fragmentTag) {
        if (TextUtils.isEmpty(fragmentTag)) {
            // 欢迎页面
            return new WelcomeFragment();
        }
        switch (fragmentTag) {
            // 主界面
            case MAIN:
                return new MainFragment();

            // 个人中心 -> 消息
            case SYSTEM_INFORMS:
                return new SystemInformsFragment();
            // 个人中心 -> 客服/反馈
            case USER_PROFILE_FEEDBACK:
                return new FeedbackFragment();
            // 个人中心 -> 其他
            case USER_PROFILE_OTHERS_MSG:
                return new WeigeeOthersMsgFragment();
            // 个人中心 -> 其他 -> 使用条款
            case TERMS_USE:
                return new TermsUseFragment();
            // 个人中心 -> 其他 -> 常见问题
            case COMMON_PROBLEMS:
                return new CommonProblemsFragment();
            // 个人中心 -> 其他 -> 常见问题
            case ABOUT_US:
                return new AboutUsFragment();

            // 包房预定
            case ROOM_RESERVATION:
                return new RoomReservationListFragment();
            // 包房预定 -> 填写预定信息
            case WRITE_RESERVE_MSG:
                return new WriteReserveMessageFragment();
            // 包房预定 -> 选择欢唱时间
            case CHECK_SINGING_TIME:
                return new CheckSingingTimeFragment();

            // 超市店铺
            case SUPERMARKET_STORE:
                return new SupermarketStoreFragment();
            // 超市商品列表
            case SUPERMARKET_SHOPPING_LIST:
                return new SupermarketChooseGoodsFragment();

            // 钱包数据
            case WALLET_DATA:
                return new MyWalletDataFragment();
            // 钱包 -> 充值返利
            case RECHARGE_RETURN:
                return new RechargeReturnFragment();
            // 钱包 -> 交易记录
            case TRANSACTION_HISTORY:
                return new TransactionHistoryFragment();
            // 钱包 -> 安全设置
            case SAFETY_SETTINGS:
                return new SafetySettingsFragment();
            default:
                throw new RuntimeRemoteException("无法识别的Fragment标识");
        }
    }
}
